<template>
  <div class="history">
    <h3>历史查询</h3>
    <nuxt-link
      :to="`/air/flights?departCity=${item.departCity}&departCode=${item.departCode}&destCity=${item.destCity}&destCode=${item.destCode}&departDate=${item.departDate}`"
      class="item"
      v-for="(item,index) in $store.state.history.searchHistory"
      :key="index"
    >
      <div class="info">
        <p>{{item.departCity}}-{{item.destCity}}</p>
        <p>{{item.departDate}}</p>
      </div>
      <span class="choose">选择</span>
    </nuxt-link>
  </div>
</template>

<script>
export default {};
</script>

<style lang="less" scoped>
.history {
  border: 1px solid #ddd;
  padding: 10px;
  h3 {
    font-size: 16px;
    font-weight: 400;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
  }
  .item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    cursor: pointer;
    .info {
      p {
        &:first-child {
          font-size: 14px;
        }
        &:last-child {
          font-size: 12px;
          color: #666;
        }
      }
    }
    .choose {
      display: block;
      padding: 2px 8px;
      font-size: 12px;
      color: #fff;
      background: #ffa500;
      border-radius: 5px;
      cursor: pointer;
    }
  }
}
</style>